package com.flight.trans.adapter;

import android.content.Context;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.flight.trans.R;
import com.flight.trans.base.BaseRecyclerAdapter;
import com.flight.trans.base.BaseViewHolder;
import com.flight.trans.bean.UnusualBean.UnusualData.UnusualImageBean;
import com.flight.trans.http.GlideLoader;
import com.flight.trans.util.LogUtils;

import java.util.List;

/**
 *    author : King
 *    date   : 2022/1/10
 *    desc   : 图片弹框
 */
public class DialogImageAdapter extends BaseRecyclerAdapter<UnusualImageBean> {

    public DialogImageAdapter(Context mContext, List<UnusualImageBean> mList) {
        super(mContext, mList);
    }

    @Override
    public int setContentView() {
        return R.layout.adapter_dialog_image;
    }

    @Override
    protected void bindData(BaseViewHolder holder, UnusualImageBean data, int position) {
        LinearLayout mLlContainerItem = holder.findViewById(R.id.mLlContainerItem);

        ImageView mIvImage = holder.findViewById(R.id.mIvImage);

        if(data == null){
            GlideLoader.loader(R.mipmap.icon_add_info, mIvImage);
        }else {
            GlideLoader.loader(data.getUrl() , mIvImage);
        }

        setOnItemClickListener(mLlContainerItem , position);
    }
}
